<?php
namespace api\controllers;

use Yii;
use yii\web\Controller;
use yii\web\Response;

/**
 * Site controller
 */
class SiteController extends Controller
{
    public function actionIndex()
    {
        exit('this is home page!');
    }

    // api 模块错误处理
    public function actionError()
    {
        Yii::$app->response->format = Response::FORMAT_JSON;
        $exception = Yii::$app->errorHandler->exception;
        if ($exception !== null) {
            Yii::error($exception);
            exit('Hey guys ,that\'s an error, illegal operation!');
        }
        exit("No errors");
    }
}
